package View;

import home.Config;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.border.BevelBorder;

public class Risultati extends JPanel{

	/**
	 * 
	 */
	private static final long serialVersionUID = 5483814085195994603L;
	private JPanel header = new JPanel(new FlowLayout(FlowLayout.LEFT));
	private JPanel content = new JPanel();
	
	public Risultati(){
		
		super(new GridBagLayout());
		
		GridBagConstraints con = new GridBagConstraints();
		
		this.setHeader(header);
		con.fill = GridBagConstraints.BOTH;
		con.weightx = 0.5;
		con.weighty = 0;
		con.gridx = 0;
		con.gridy = 0;
		this.add(header, con); 
		
		this.setContent(content);
		con.fill = GridBagConstraints.BOTH;
		con.weightx = 0.165;
		con.weighty = 0.5;
		con.gridx = 0;
		con.gridy = 1;
		this.add(content, con);
		
	}
	
	
private JPanel setHeader(JPanel panel){
		
		// custumizza l'header
		panel.setBackground(Config.getConfig().getMarrone());
		panel.setBorder(BorderFactory.createLineBorder(Color.white));
		panel.setPreferredSize(new Dimension(966, 30));
		panel.setMinimumSize(new Dimension(966, 30));
		
		// crea il primo bottone e lo aggiunge
	    JButton x = new JButton();
	    x.setFont(Config.getConfig().getFont().deriveFont((float)15));
		x.setForeground(Color.white);
		x.setText("Home");
		x.setFocusPainted(false);
		x.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED,new Color(165,64,66),new Color(108,55,56),null,new Color(204,108,110)));
		x.setEnabled(false);
		x.setContentAreaFilled(true);
	    x.setBackground(Config.getConfig().getCaramello());
	    x.setPreferredSize(new Dimension(100, 18));
	    panel.add(x);
	    
	    //Crea le freccie e le aggiunge
		JLabel l1 = new JLabel(Clio.createImageIcon("images/freccia.png"));
		l1.setMaximumSize(new Dimension(12, 19));
		l1.setPreferredSize(new Dimension(12, 19));
		panel.add(l1);
		JLabel l2 = new JLabel(Clio.createImageIcon("images/freccia.png"));
		l2.setMaximumSize(new Dimension(12, 19));
		l2.setPreferredSize(new Dimension(12, 19));
		panel.add(l2);
	    
		// crea il secondo bottone e lo aggiunge
	    JButton xx = new JButton();
	    xx.setFont(Config.getConfig().getFont().deriveFont((float)15));
		xx.setForeground(Color.white);
		xx.setText("Strumenti e Cosmetici");
		xx.setFocusPainted(false);
		xx.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED,new Color(165,64,66),new Color(204,108,110),null,new Color(108,55,56)));
		xx.setContentAreaFilled(true);
		xx.setEnabled(false);
	    xx.setBackground(Config.getConfig().getCaramello());
	    xx.setPreferredSize(new Dimension(200, 18));
	    panel.add(xx);
	    
	    //Crea le freccie e le aggiunge
		JLabel l3 = new JLabel(Clio.createImageIcon("images/freccia.png"));
		l1.setMaximumSize(new Dimension(12, 19));
		l1.setPreferredSize(new Dimension(12, 19));
		panel.add(l3);
		JLabel l4 = new JLabel(Clio.createImageIcon("images/freccia.png"));
		l2.setMaximumSize(new Dimension(12, 19));
		l2.setPreferredSize(new Dimension(12, 19));
		panel.add(l4);
		
		// crea il secondo bottone e lo aggiunge
	    JButton xxx = new JButton();
	    xxx.setFont(Config.getConfig().getFont().deriveFont((float)15));
		xxx.setForeground(Color.white);
		xxx.setText("Risultati");
		xxx.setFocusPainted(false);
		xxx.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED,new Color(165,64,66),new Color(204,108,110),null,new Color(108,55,56)));
		xxx.setContentAreaFilled(true);
	    xxx.setBackground(Config.getConfig().getCaramello());
	    xxx.setPreferredSize(new Dimension(120, 18));
	    panel.add(xxx);
	    
		return panel;
	}
	

	private JPanel setContent(JPanel panel){
		
		JTable t = new JTable();
		
		panel.add(t);
		return panel;
		
	}

}
